<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
  <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  <link rel="stylesheet" href="../../css/animate.css">
  <link rel="stylesheet" href="../../iconfont/iconfont.css">
  <link rel="stylesheet" href="../../css/mescroll.css">
  <link rel="stylesheet" href="../../css/gloab.css">
  <title>提现</title>
  <style>
    .form-son-input{
      line-height: 1rem;
      font-size:0.28rem;
    }
    .select{
        background-color: white;
    }
    input[disabled]{color:#000;background:#fff;}
  </style>
</head>
<body>
  <div id="app">
    <div id="public-header" style="padding-bottom:0.8rem;">
      <div id="statusbar"></div>
      <header class="public-header">
        <div class="public-header-lf iconfont icon-fanhui" @click="javascript:api.closeWin();"></div>
        <div class="public-header-title">提现
        </div>
      </header>
      <!-- <div class="tixian-bar auto flex">
        <div class="tixian-bar-lf F3 flex wrap">
          <div class="tixian-bar-lf-son" style="margin-right:2.6%;" @click="one" v-bind:class="{hover: show}" v-model="5">5元</div>
          <div class="tixian-bar-lf-son" style="margin-right:2.6%;" @click="two" v-bind:class="{hover: show1}">10元</div>
          <div class="tixian-bar-lf-son" style="margin-right:2.6%;"  @click="three" v-bind:class="{hover: show2}">15元</div>
          <div class="tixian-bar-lf-son"  @click="four"  v-bind:class="{hover: show3}">20元</div>
        </div>
        <div class="tixian-bar-ipt F4" style="display:none;"><input type="text" placeholder="请输入自定义金额"></div>
        <div class="tixian-bar-rt F1" style="text-align:right;line-height:0.5rem;color:#56b1fd;display:none;">返回&nbsp;></div>
        <div class="tixian-bar-rt F1" style="text-align:right;line-height:0.5rem;color:#56b1fd;" @click="five">可自定义金额</div>
      </div> -->
    </div>
    <div class="fabu-body" style="margin-top:-0.6rem;background-color:#fff;">
      <div class="form-son-input flex">
        <div class="F1">金额</div>
        <div class="F3">
          <input type="text" v-model='allmoney'>
        </div>
      </div>
      <div class="form-son-input flex">
        <div class="F1">支付宝账户</div>
        <div class="F3">
          <input type="text" v-model='alipaynumber' placeholder="请添加支付账号如：18888888888" disabled="disabled">
        </div>
      </div>
      <div class="form-son-input flex">
        <div class="F1">姓名</div>
        <div class="F3">
          <input type="text" v-model='name'  placeholder="请填写真实姓名" disabled="disabled">
        </div>
      </div>
      <!-- <div class="form-son-input flex">
        <div class="F1">选择银行</div>
        <div class="F3">
          <select class="select" name="" v-model="banktype" @click="choicebank">
            <option value="">选择银行</option>
            <option v-for="item in banktypevalue" :key="item.id" :value="item.id" :label="item.mingcheng">{{item.mingcheng}}</option>
          </select>
        </div>
      </div>
      <div class="form-son-input flex">
        <div class="F1">搜索开户行</div>
        <div class="F3">
          <input @blur="address" type="text" v-model="bankaddress" placeholder="例如‘番禺支行’则输入‘番禺’" >
        </div>
      </div>
      <div class="form-son-input flex" style="border:none;">
        <div class="F1">选择开户行</div>
        <div class="F3">
          <select class="select" name="" v-model="bank">
              <option value="">选择开户行</option>
            <option v-for="item in bankvalue" :key="item.lianhanghao" :value="item.lianhanghao" :label="item.wangdianmingcheng">{{item.wangdianmingcheng}}</option>
          </select>
        </div>
      </div> -->
    </div>
    <div class="vip-one-pay" @click="cash">确认提现</div>
    <div class="tixian-tishi auto" style="padding-bottom:30px;">
      <div class="tuijian-shengji-title auto">提示</div>
      <p class="auto">1、提现24小时内到帐</p>
      <p class="auto">2、{{money}}元起提。遇见问题联系客服：<font style="color:#f00;">{{wechat}}</font></p>
      <p class="auto" style="color:#f00;">3、提现手续费{{handlingfee}}%。</p>
      <span class="" style="color:#6095fe;width:48%;margin-left:3%;float:left;">4、提现时间：09:00-22:00。</span>
      <span style="color:#fff;font-size:0.25rem;background:#f00;border-radius:0.02rem;width:auto;padding:0 0.02rem;height:0.4rem;line-height:0.4rem;text-align:center;float:left;" @click="tishi">修改账户信息</span>
    </div>
    <div style="background:rgba(0,0,0,0.5);width:100%;height:1000px;position:fixed;top:0;left:0;right:0;z-index:9999;" id="tc" v-if="content">
       <div style="width:90%;height:auto;background:#fff;margin:3rem auto;padding:0.5rem 0.01rem 0;border-radius:0.3rem;position:relative;left:0;right:0;top:0.5rem;overflow-y:hidden;">
         <div style="width:90%;margin:0 auto;text-align:center;line-height:0.45rem;font-size:0.35rem;height:0.45rem;font-weight:blod;">系统消息</div>
         <div style="width:90%;margin:0.25rem auto;" v-html="content">
         </div>
         <div style="width:100%;background:#eee;height:1rem;text-align:center;line-height:1rem;position:relative;buttom:0rem;left:0;right:0;font-size:0.3rem;color:#357ddc;" @click="delImg">
           我知道了
           <!-- <div style="width:25%;height:0.45rem;text-align:center;line-height:0.45rem;font-size:0.3rem;margin:auto;color:#4797f4;border-radius:0.12rem;" @click="delImg"></div> -->
         </div>
       </div>
    </div>
  </div>
  <div class="public-progress" style="z-index:9;">
    <img src="../../icon/icon150x150.png" alt="" class="animated infinite flash" style="width:200px;height:200px;display:block;margin:200px auto;">
  </div>
</body>
<script src="../../script/api.js"></script>
<script src="../../script/jquery.js"></script>
<script src="../../script/mescroll.js"></script>
<script src="../../script/vue.js"></script>
<script src="../../script/app.js"></script>
<script src="../../script/jsencrypt.js"></script>
<script src="../../script/fastclick.js"></script>

<script>
var vm;
var mescroll;
apiready=function(){
  api.removeLaunchView();
  setBar("statusbar");
  setFont(750);
  startVue();
  $(".public-progress").fadeOut(1000);
  setTimeout(function(){
    $(".public-progress").css({"display":"none"});
  },2000);
}
function startVue(){
  vm = new Vue({
    el:"#app",
    data:{
      gdtt:['100','1000','5000','10000','20000','50000'],
      num:0,
      allmoney:api.pageParam.price,
      name:'',
      alipaynumber:'',
      type:'3',
      handlingfee:'',
      wechat:'',
      money:'',
      content:'',
    },
    created:function(){
      this.getValue();
      this.getAccount();
      this.getNewValue();
    },
    methods:{
      delImg:function(){
        $('#tc').css({'display':'none'});
      },
      getNewValue:function(){
        api.ajax({
            url: apiUrl+'api/users/withdrawalrules',
            method: 'post',
            data: {
                values: {
                },
            }
        },function(ret, err){
            if (ret.status) {
              vm.content = ret.data;
              $('#tc').css({'display':'block'});
            } else {
              vm.content = '';
            }
        });

      },
      tishi:function(){
        api.openWin({
            name: 'updateaccount',
            reload:true,
            url: './updateaccount.html',
            pageParam:{
              wechat:vm.wechat,
            }
        });
        // api.alert({
        //     // title: 'testtitle',
        //     msg: '修改账户信息，请联系客服微信：'+vm.wechat+'修改',
        // }, function(ret, err){
        //     if( ret ){
        //         //  alert( JSON.stringify( ret ) );
        //     }else{
        //         //  alert( JSON.stringify( err ) );
        //     }
        // });

      },
      getAccount:function(){
        api.ajax({
            url: apiUrl+'/api/user/checkAccount',
            method: 'post',
            data: {
                values: {
                  token:$api.getStorage('token'),
                },
            }
        },function(ret, err){
			console.log(JSON.stringify(ret))
            if (ret.code==1) {
              vm.name = ret.data['alipay_name'];
              vm.alipaynumber = ret.data['alipay_account'];
            } else {
              var dialogBox = api.require('dialogBox');
              dialogBox.alert({
                  texts: {
                      content: '检测到你还未绑定账户信息，是否前往绑定？',
                      leftBtnTitle: '取消',
                      rightBtnTitle: '确认'
                  },
                  styles: {
                      bg: '#fff',
                      w: 300,
                      corner:2,
                      content: {
                          color: '#000',
                          size: 14
                      },
                      left: {
                          marginB: 7,
                          marginL: 20,
                          w: 130,
                          h: 35,
                          corner: 2,
                          bg: '#fff',
                          size: 12
                      },
                      right: {
                          marginB: 7,
                          marginL: 10,
                          w: 130,
                          h: 35,
                          corner: 2,
                          bg: '#fff',
                          size: 12
                      }
                  }
              }, function(ret) {
                  if (ret.eventType == 'left') {
                      var dialogBox = api.require('dialogBox');
                      dialogBox.close({
                          dialogName: 'alert'
                      });
                  }else if(ret.eventType == 'right'){
                    var dialogBox = api.require('dialogBox');
                    dialogBox.close({
                        dialogName: 'alert'
                    });
                    api.openWin({
                        name: 'saveaccount',
                        reload:true,
                        url: './saveaccount.html',
                    });
                  }
              });
            }
        });

      },
      cash:function(){
        if(vm.alipaynumber == ""){
          msg('请输入支付宝账号');
          return;
        }
        if(vm.name == ""){
          api.toast({
              msg: '请输入正确的姓名',
              duration: 2000,
              location: 'middle'
          });
          msg('请填写真实姓名');
          return;
        }
        if (vm.allmoney<vm.money) {
          msg('最低提现不得低于'+vm.money+'元');
          return;
        }
        var amount = (vm.allmoney - vm.allmoney*vm.handlingfee/100).toFixed(2);
        var fwamount = (vm.allmoney*vm.handlingfee/100).toFixed(2);
        var dialogBox = api.require('dialogBox');
        dialogBox.alert({
            texts: {
                content: '扣去手续费实际到账:'+amount+'请核对好支付宝账号，提交后将在24小时内到账',
                leftBtnTitle: '取消',
                rightBtnTitle: '确认'
            },
            styles: {
                bg: '#fff',
                w: 300,
                corner:2,
                content: {
                    color: '#000',
                    size: 14
                },
                left: {
                    marginB: 7,
                    marginL: 20,
                    w: 130,
                    h: 35,
                    corner: 2,
                    bg: '#fff',
                    size: 12
                },
                right: {
                    marginB: 7,
                    marginL: 10,
                    w: 130,
                    h: 35,
                    corner: 2,
                    bg: '#fff',
                    size: 12
                }
            }
        }, function(ret) {
            if (ret.eventType == 'left') {
                var dialogBox = api.require('dialogBox');
                dialogBox.close({
                    dialogName: 'alert'
                });
                location.reload();
            }else if(ret.eventType == 'right'){
              var dialogBox = api.require('dialogBox');
              dialogBox.close({
                  dialogName: 'alert'
              });
              api.ajax({
                  url: apiUrl+'/api/user/withdraw',
                  method: 'post',
                  data: {
                      values: {
                          token:$api.getStorage('token'),
						  alipay_name:vm.name,
						  alipay_account:vm.alipaynumber,
						  money:vm.allmoney
                      },
                  }
              },function(ret, err){
				  console.log(JSON.stringify(ret))
                  if (ret.code==1) {
                    msg(ret.msg);
                    setTimeout(function(){
                    api.openWin({
                      name: 'personal',
                      reload:true,
                      url:'./personal.html',
                    });
                    },500);
                  }else{
                    msg(ret.msg);
                  }
              });
            }
        });
      },
      getValue:function(){
        api.ajax({
            url: apiUrl+'/api/index/withdrawSetting',
            method: 'post',
            data: {
                values: {
                },
            }
        },function(ret, err){
			console.log(JSON.stringify(ret))
            if (ret.code==1) {
              vm.wechat = ret.data.wechat_kefu;
              vm.handlingfee = ret.data.fee;
              vm.money = ret.data.min_money;
            }
        });

      },
    }
  })
}

</script>
</html>
